using System;
using System.Web;
using System.Collections.Generic;
using System.Text;



namespace ViewStateEliminator.Configuration
{
    /// <summary>
    /// Implements a way to get a UniqueID
    /// </summary>
    public interface IUserUniqueID
    {
      string GetUniqueID();
    }
    /// <summary>
    /// Uses the HttpContext SessionID of a user as a UniqueID
    /// </summary>
    public class ViewStateHttpContextSessionID : IUserUniqueID
    {
        #region IUserUniqueID Members

        public string GetUniqueID()
        {
            return System.Web.HttpContext.Current.Session.SessionID;
        }

        #endregion
    }
    /// <summary>
    /// Uses a Application GUID as the UniqueID
    /// </summary>
    public class ViewStateGUID : IUserUniqueID
    {
        #region IUserUniqueID Members

        public string GetUniqueID()
        {
            return System.Guid.NewGuid().ToString();
        }

        #endregion
    }
    /// <summary>
    /// Uses a combination of Ip Address, page being accessed and a timestamp.
    /// </summary>
    public class ViewStateIpPageTimeStamp : IUserUniqueID
    {
        #region IUserUniqueID Members

        public string GetUniqueID()
        {
            return System.Web.HttpContext.Current.Request.UserHostAddress.ToString() + "@" + System.Web.HttpContext.Current.Request.RawUrl + "@" + DateTime.Now;
        }

        #endregion
    }
}
